﻿using Acme.BookStore.Books;
using Acme.BookStore.Goodss;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Acme.BookStore
{
    public class GoodsAppService :
        CrudAppService<
            Goods, //The Book entity
            GoodsDto, //Used to show books
            int, //Primary key of the book entity
            queryDto, //Used for paging/sorting
            CreateUpdateGoodsDto>, //Used to create/update a book
            IGoodsAppService //implement the IBookAppService
    {
        public GoodsAppService(IRepository<Goods, int> repository)
            : base(repository)
        {

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [Obsolete]
        protected override IQueryable<Goods> CreateFilteredQuery(queryDto input)
        {
            return base.CreateFilteredQuery(input).WhereIf(!string.IsNullOrEmpty(input.productName), s => s.productName.Contains(input.productName));
        }
    }
}
